package test.com.sms.selenium.singlepoint.util;

import org.openqa.selenium.By;

import test.com.sms.selenium.framework.SeleniumPageUtil;
import test.com.sms.selenium.util.SeleniumUtil;

public class SpToolsUDFRestrictionListsPageUtil extends SeleniumPageUtil {
	public final static By TRL_INPUT_NEW = By.id("RestrictLists1_btnNew");
	public final static By TRL_LINK_CLOSE = By.id("RestrictLists1_btnDone");
	public final static By TRL_TD_HEADER = By.xpath("//*[@id='form1']/table/tbody/tr/td/div/table/tbody/tr/td[2]");
	public final static By TRL_TD_DESCRIPTION = By.xpath("//*[@id='tblResults']/tbody/tr[2]/td[2]");
	public final static By TRL_TD_LIST_TABLE = By.xpath("//*[@id='tblResults']/tbody/tr[2]/td[3]");
	public final static By TRL_TD_LIST_VALUE_FIELD = By.xpath("//*[@id='tblResults']/tbody/tr[2]/td[4]");
	public final static By TRL_TD_LIST_DISPLAY_FIELD = By.xpath("//*[@id='tblResults']/tbody/tr[2]/td[5]");
	public final static By TRL_TD_LIST_PARENT_FIELD = By.xpath("//*[@id='tblResults']/tbody/tr[2]/td[6]");
	public final static By TRL_TD_FILTER_TABLE = By.xpath("//*[@id='tblResults']/tbody/tr[2]/td[7]");
	public final static By TRL_TD_FILTER_VALUE_FIELD = By.xpath("//*[@id='tblResults']/tbody/tr[2]/td[8]");
	public final static By TRL_TD_FILTER_DISPLAY = By.xpath("//*[@id='tblResults']/tbody/tr[2]/td[9]");
	
	public static void enterToolsRestrictionListsPage(){
		SpToolsUDFDefaultPageUtil.enterToolsUserDefinedFormsPage();
		SeleniumUtil.click(SeleniumUtil.getCachedElement(SpToolsUDFDefaultPageUtil.TUDF_LINK_RESTRICTION_LISTS));
		waitForPageToLoad();
	}
	
	public static void waitForPageToLoad(){
		SeleniumUtil.selectDefaultContent();
		SeleniumUtil.selectFrame(SpHomePageUtil.HOME_FRAME_CONTENT_NAME);
		SeleniumUtil.waitOnElements(new By[]{
				TRL_INPUT_NEW, TRL_LINK_CLOSE
			});
		SeleniumUtil.isDisplayed(SeleniumUtil.findElement(TRL_INPUT_NEW));
		SeleniumUtil.isDisplayed(SeleniumUtil.findElement(TRL_LINK_CLOSE));
	}
}
